package com.fcl.oschina.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.fcl.mylibrary.ImageLoader.ImageLoader;
import com.fcl.mylibrary.recyclerviewhelper.BaseAdapter;
import com.fcl.mylibrary.recyclerviewhelper.BaseHolder;
import com.fcl.mylibrary.util.StringUtil;
import com.fcl.oschina.R;
import com.fcl.oschina.entity.TweetCommentEntity;

import java.util.List;

/**
 * Created by Administrator on 2017/3/21.
 */

public class TweetCommentAdapter extends BaseAdapter<TweetCommentEntity> {
    public TweetCommentAdapter(Context context, int layoutId, List<TweetCommentEntity> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void bindHolder(BaseHolder baseHolder, TweetCommentEntity data) {
        super.bindHolder(baseHolder, data);
        baseHolder.setText(R.id.user_name, data.getAuthor().getName());
        baseHolder.setText(R.id.content, data.getContent());
        baseHolder.setText(R.id.date, StringUtil.formatSomeAgo(data.getPubDate()));
        ImageLoader.getInstance().loadImage(data.getAuthor().getPortrait(), (ImageView) baseHolder.getView(R.id.user_avtar), true);
    }
}
